#ifndef DNBBINARY_H_
#define DNBBINARY_H_

#include<iostream>
#include<vector>
#include<map>
#include<fstream>
#include<cstring>
using namespace std;

class DNBBinary {
    
    public:
        // 类别下标为numAttributes.
        DNBBinary();
        ~DNBBinary();
        void initClassifier(int numAttributes,bool multiNominal);
        void saveClassifier(fstream &);
        void loadClassifier(fstream &);
        void destoryClassifier();
        void updateClassifier(map<int,int> &);
        double getLogProbForTargetClass(map<int,int> &);
        void setTargetClass(int classid);

        // bool,int,double,double*
        bool m_multiNominalWord; 
        int m_classIndex = -1;
        /** number of unique words */
        int m_numAttributes;
        //set the target class
        int m_targetClass = -1;       //外部设定，与分类器下标关联
       
        double m_WordLaplace=1;
        double m_classRatio;        //dxp:类别概率，即属于这个类与不属于这个类的概率之间比率
        double m_wordRatio;

        double * m_wordsPerClass;
        double * m_classDistribution;
        double * m_coefficient; 
        double ** m_perWordPerClass;
};

#endif
